/**
 * VYPe11 Project
 * VYPe11 language compiler.
 * Authors: Jozef Lang (xlangj01), 
 * 			Zoltan Zemko (xzemko01)
 * 2011
 */
package cz.vutbr.fit.VYPe.team18.VYPe11.codegeneration.MIPS32;

import java.util.*;

import cz.vutbr.fit.VYPe.team18.VYPe11.codegeneration.*;
import cz.vutbr.fit.VYPe.team18.VYPe11.codegeneration.MIPS32.*;

public final class MIPS32Data {
	
	private final IDataStack _dataStack;
	private final IVariableSet _variableSet;
	
	public MIPS32Data(final int stackBaseSize) {
		_dataStack = new MIPS32DataStack(stackBaseSize);
		_variableSet = new MIPS32VariableSet();
	}
	
	public void storeString(final String name, final int size) {
		_variableSet.addVariable(name, _dataStack.pushString(size));
	}
	
	public void storeInteger(final String name) {
		_variableSet.addVariable(name, _dataStack.pushInteger());
	}
	
	public void storeShort(final String name) {
		_variableSet.addVariable(name, _dataStack.pushShort());
	}
	
	public void storeChar(final String name) {
		_variableSet.addVariable(name, _dataStack.pushChar());
	}
	
	public int loadVariable(final String name) {
		return _variableSet.getVariable(name);
	}
	
}
